import { lazy } from "react";
import {Navigate} from 'react-router-dom'
let Home=lazy(()=>import('../pages/home/Index'))
let Login=lazy(()=>import('../pages/login/Index'))
let Detail=lazy(()=>import('../pages/detail/Index'))
let Register=lazy(()=>import('../pages/register/Index'))
let Order=lazy(()=>import('../pages/order/Index'))
let Index=lazy(()=>import('../pages/index/Index'))
let Mess=lazy(()=>import('../pages/mess/Index'))
let My=lazy(()=>import('../pages/my/Index'))
let List=lazy(()=>import('../pages/list/Index'))
import {
    AppOutline,
    MessageOutline,
    MessageFill,
    UnorderedListOutline,
  } from 'antd-mobile-icons'
export const houserouters=[
    {
        path:'/home',
        element:<Home></Home>,
        icon:<AppOutline></AppOutline>,
        title:"首页",
        
    },
    {
        path:'/order',
        element:<Order></Order>,
        icon:<MessageOutline></MessageOutline>,
        title:"订单",
       
    },
    {
        path:'/mess',
        element:<Mess></Mess>,
        icon:<MessageFill></MessageFill>,
        title:"信息"
    },
    {
        path:'/my',
        element:<My></My>,
        icon:<UnorderedListOutline></UnorderedListOutline>,
        title:"我的"
    },
]
export const routes=[
    {
        path:'/',
        element:<Index></Index>,
        children:[
            ...houserouters,
            {
                path:'/',
                element:<Navigate to='/home'></Navigate>
            }
        ]
    },
    {
        path:'/login',
        element:<Login></Login>,
    },
    {
        path:'/register',
        element:<Register></Register>,
    },
    {
        path:'/detail',
        element:<Detail></Detail>,
    },
    {
        path:'/list',
        element:<List></List>,
    },
]

export default routes